package com.dglg.spring.service.impl;

import com.dglg.spring.dao.ExcelDao;
import com.dglg.spring.model.Student;
import com.dglg.spring.service.ExcelService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ExcelServicelmpl implements ExcelService {
    @Autowired
    public ExcelDao excelDao;

    @Override
    public Student student(int j, String cell, Student student) {
//        Student student = new Student();
        switch (j) {
            case 0:
                student.setStudentId(cell);
                break;
            case 1:
                student.setStudentName(cell);
                break;
            case 2:
                student.setGender(cell);
                break;
            case 3:
                student.setGrade(cell);
                break;
            case 4:
                student.setBanji(cell);
                break;
            case 5:
                student.setMajor(cell);
                break;
            default:
                student = null;
        }
        return student;
    }

    @Override
    public List<String> getStudentIdByMajor(String className) {
        return this.excelDao.getStudentIdByMajor(className);
    }


}
